import request from '@/router/axios';
// 获取角色列表
export const getRoleList = (current, size, params) => {
  return request({
    url: '/api/oms-system/role/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
// 新增角色
export const add = (row) => {
  return request({
    url: '/api/oms-system/role/submit',
    method: 'post',
    data: row
  })
}
// 更新角色
export const update = (row) => {
  return request({
    url: '/api/oms-system/role/submit',
    method: 'post',
    data: row
  })
}
// 获取树状菜单
export const grantTree = () => {
  return request({
    url: '/api/things-system/menu/tree',
    method: 'get',
  })
}
// 获取角色权限
export const getRoleMenus = (roleId) => {
  return request({
    url: '/api/oms-system/role/rolemenus',
    method: 'get',
    params: {
      roleId,
    }
  })
}
//设置角色菜单权限
export const setRoleMenus = (roleId, menuIds) => {
  return request({
    url: '/api/oms-system/role/setrolemenus',
    method: 'post',
    data: {
      roleId,
      menuIds
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/blade-system/role/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}






export const getRoleTree = (tenantId) => {
  return request({
    url: '/api/blade-system/role/tree',
    method: 'get',
    params: {
      tenantId,
    }
  })
}

export const getRoleTreeById = (roleId) => {
  return request({
    url: '/api/blade-system/role/tree-by-id',
    method: 'get',
    params: {
      roleId,
    }
  })
}
